#ifndef EmoRecogCore_H
#define EmoRecogCore_H

#include <QObject>
#include <armadillo>
#include <mutex>
#include <QTimer>
#include "EmoRecBase.h"
#include "GenEEGData.h"
#include "EmotionInterface.h"


class EmoRecogCore : public QObject, public EmoRecBase
{
    Q_OBJECT
public:
    enum WorkingMode{
        Free = -1,
        Train = 0,
        Predict = 1
    };
    Q_ENUM(WorkingMode)
     // 如果需要在信号和槽中使用枚举类型，可以使用 Q_DECLARE_METATYPE 宏
    // Q_INVOKABLE void setEnumValue(WorkingMode value);
    // Q_INVOKABLE WorkingMode enumValue() const;


public:
    explicit EmoRecogCore(ConfigImport* sysconf, QObject* parent = nullptr);
    ~EmoRecogCore();

    void clear(WorkingMode mode);
    
    void readyToCreateModel();
    void showAcc();

    WorkingMode &workingMode;

signals:
    void send_predictResult(int);

public slots:
    long long receiveData(const arma::cube&);
    long long receiveData(const GenEEGData &data);
    void slt_receivePredictData(const arma::rowvec &data);
    void slt_receivePredictVideoLabel(EmotionInterface::EmoMode mode);
    

    void setWorkingMode(WorkingMode data);
    void run();


private:

    static std::mutex mutex_emoDataCpy;
    // 训练、测试模式标志
    WorkingMode m_workingMode;
    // 生成脑网络标志
    bool networkCreate_enable;
    
    arma::cube train_data;
    arma::rowvec predict_data;

    QTimer workTick;

    int videoLabel;
    long correctCount = 0;
    long errorCount = 0;




};






#endif // !EmoRecogCore_H


